home *** CD-ROM | disk | FTP | other *** search
- /*
- File: StatusMonitor.h
-
- Copyright: © 1991-1994 by Apple Computer, Inc.
- All rights reserved.
-
- Part of the AOCE Sample SMSAM Package. Consult the license
- which came with this software for your specific legal rights.
-
- */
-
-
-
- #ifndef __STATUSMONITOR__
- #define __STATUSMONITOR__
-
- #ifndef __BLJSTANDARDINCLUDES__
- #include "BLJStandardIncludes.h"
- #endif
-
- #ifndef __OBJECTLIST__
- #include "ObjectList.h"
- #endif
-
- #ifndef __BUFFER__
- #include "Buffer.h"
- #endif
-
- #ifndef __UAPPLEEVENTS__
- #include "UAppleEvents.h"
- #endif
-
- #pragma push
- #pragma segment StatusMonitor
-
- const long cSupportMonitoring = 9999;
- const long cStatusLogInit = 99;
- const long cItemsToBeMonitored = 100;
- const long cStopMonitoring = 101;
- const long cStatusSessionAlive = 102;
- const long cMonitorCommand = 103;
- const long cSetConfigCommand = 104;
- const long cGetConfigCommand = 105;
-
- DeclareList(ABuffer,TBufferList);
-
- /***********************************|****************************************/
-
- class TSession : public THandleObject
- {
- public:
- TSession ( const TAddressDescription&, long theSessionID );
- virtual ~TSession();
-
- TAddressDescription& GetAddress();
- long GetSessionID() const;
-
- void SetItemValue ( TBufferList* );
- unsigned long CountItems() const;
- long GetItemValue(unsigned long index) const;
-
- Boolean HasTimerExpired() const;
- void ResetTimer();
-
- protected: TAddressDescription fAddress;
- long fSessionID;
- TBufferList* fMonitorList;
- unsigned long fPeriodicCheckSessionAlive;
- };
-
- DeclareList(TSession,TSessionList);
-
- /***********************************|****************************************/
-
- class TMailGateway;
-
- class TStatusMonitor : public TDirectObject
- {
- public:
- TStatusMonitor(TMailGateway* gateway);
- virtual ~TStatusMonitor();
-
- void HandleAppleEvents(const AppleEvent& message,const AppleEvent& reply, long info);
- OSErr Run ();
-
- void UpdateMonitor();
- void UpdateLog(long infoID, char* theMsg);
- TSession* FindMatchingSession(const TAddressDescription& theAddress, long docSessionID) const;
-
- protected: thread* fMonitorThread;
- TMailGateway* fMailGateway;
- TSessionList fSessionList;
- };
-
- /***********************************|****************************************/
-
- inline unsigned long TSession::CountItems() const { return fMonitorList ? fMonitorList->Count () : 0; }
- inline TAddressDescription& TSession::GetAddress() { return fAddress; }
- inline long TSession::GetSessionID() const { return fSessionID; }
-
- /***********************************|****************************************/
-
- #pragma pop
-
- #endif // __STATUSMONITOR__
-